-
Notifications
You must be signed in to change notification settings - Fork 370
fix the engine_cache bug #3915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix the engine_cache bug #3915
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some changes that do not conform to Python style guidelines:
--- /home/runner/work/TensorRT/TensorRT/tests/py/dynamo/models/test_engine_cache.py 2025-11-20 21:15:55.433017+00:00
+++ /home/runner/work/TensorRT/TensorRT/tests/py/dynamo/models/test_engine_cache.py 2025-11-20 21:16:43.787199+00:00
@@ -28,10 +28,11 @@
self.engine_cache_dir = engine_cache_dir
if not os.path.exists(self.engine_cache_dir):
os.makedirs(self.engine_cache_dir, exist_ok=True)
self.hashes = {}
+
def exist(self, hash: str) -> bool:
return hash in self.hashes
def save(
self,There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some changes that do not conform to Python style guidelines:
--- /home/runner/work/TensorRT/TensorRT/tests/py/dynamo/models/test_engine_cache.py 2025-11-20 21:16:09.872580+00:00
+++ /home/runner/work/TensorRT/TensorRT/tests/py/dynamo/models/test_engine_cache.py 2025-11-20 21:16:52.726852+00:00
@@ -28,10 +28,11 @@
self.engine_cache_dir = engine_cache_dir
if not os.path.exists(self.engine_cache_dir):
os.makedirs(self.engine_cache_dir, exist_ok=True)
self.hashes = {}
+
def exist(self, hash: str) -> bool:
return hash in self.hashes
def save(
self,There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some changes that do not conform to Python style guidelines:
--- /home/runner/work/TensorRT/TensorRT/tests/py/dynamo/models/test_engine_cache.py 2025-11-20 21:16:09.968505+00:00
+++ /home/runner/work/TensorRT/TensorRT/tests/py/dynamo/models/test_engine_cache.py 2025-11-20 21:16:54.092908+00:00
@@ -28,10 +28,11 @@
self.engine_cache_dir = engine_cache_dir
if not os.path.exists(self.engine_cache_dir):
os.makedirs(self.engine_cache_dir, exist_ok=True)
self.hashes = {}
+
def exist(self, hash: str) -> bool:
return hash in self.hashes
def save(
self,There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some changes that do not conform to Python style guidelines:
--- /home/runner/work/TensorRT/TensorRT/tests/py/dynamo/models/test_engine_cache.py 2025-11-20 21:16:14.709932+00:00
+++ /home/runner/work/TensorRT/TensorRT/tests/py/dynamo/models/test_engine_cache.py 2025-11-20 21:16:57.038199+00:00
@@ -28,10 +28,11 @@
self.engine_cache_dir = engine_cache_dir
if not os.path.exists(self.engine_cache_dir):
os.makedirs(self.engine_cache_dir, exist_ok=True)
self.hashes = {}
+
def exist(self, hash: str) -> bool:
return hash in self.hashes
def save(
self,
Description
The engine_cache bug is introduced due to recent cpu/memory optimzation feature where we moved the cache insert logic
Previously, cache_insert will only happen after we actually build the engine.
Now we moved to convert_module, so it is possible the engine is the cached one and we insert cache again.
The fix is to add a check if the cache exists already, then do not insert again.
Fixes # (issue)
Type of change
Please delete options that are not relevant and/or add your own.
Checklist: